import { post, get } from '@/utils/request.js';

// 获取用户信息
export const getUserInfoApi = (params) => {
	return get(
		`getUserInfo&userid=${params}
`
	)
}
//上传头像接口
export const uploadImg = (params) => {
	return get(
		`fsfileupload&userid=${params}`
	)
}
//更新自己的用户信息
export const uploadUserInfo = (params) => {
	return get(
		`updateUserInfo&userid=${params.userid}&nickname=${params.nickname}&avatar=${params.avatar}`, {}, { loading: true }
	)
}
//登录
export const loginApi = (params) => {
	return get(`login&username=${params.UserName}&password=${params.Password}&code=&type=0`, {}, { needLogin: false })
}
//忘记密码
export const resetPasswordApi = (params) => {
	return get(`checkPwd&username=${params.phone}&newpassword=${params.password}&yzm=${params.code}`)
}

//获取验证码		weilanDetails
export const getCodeApi = (params) => {
	return get(`getYanZhengCode&username=${params.UserName}&isfindPw=${params.isfindPw}`, {}, { needLogin: false })
}

//注册
export const registerApi = (params) => {
	return get(
		`register&username=${params.username}&password=${params.password}&avatar=${params.avatar}&yzm=${params.yzm}`,
		{},
		{ needLogin: false },
	)
}

// 获取设备列表
export const getSheBeiListApi = (params) => {
	 
	return get(
		`getDeviceList&userid=${params}`
	)
}
// 获取设备列表
export const addSheBeiApi = (params) => {
	return get(
		`addDevice&imei=${params.imei}&userid=${params.userid}&title=${params.title}&deviceimg=${params.deviceimg}&dtype=${params.dtype}&cptype=${params.cptype}`
	)
}

// 获取宠物列表
export const getChongWuListApi = (params) => {
	return get(
		`chongwulist&userid=${params}`
	)
}

//添加宠物
export const addChongWuApi = (params) => {
	return get(
		`addchongwu&imei=${params.imei}&userid=${params.userid}&title=${params.title}&deviceimg=${params.avatar}&sex=${params.sex}&nickname=${params.nickname}&pingzhong=${params.type}&age=${params.age}&tizhong=${params.tizhong}`
	);
};

// 修改宠物顺序
export const changeSortChongWuListAPi = (params) => {
	return get(
		`chongwuorder&ids=${params.ids}&listorder=${params.listorder}`
	);
}

//根据id获取宠物详情
export const getChongWuDetailsApi = (params) => {
	return get(
		`chongwudetail&id=${params}`
	)
}

//修改宠物
export const channgeChongWuApi = (params) => {
	return get(
		`editchongwu&imei=${params.imei}&userid=${params.userid}&title=${params.title}&deviceimg=${params.avatar}&sex=${params.sex}&nickname=${params.nickname}&pingzhong=${params.type}&age=${params.age}&tizhong=${params.tizhong}&id=${params.id}`
	);
};
// 获取消息列表
export const getMessageAllListAPi = (params) => {
	 
	return get(
		`getAllAlarmList&userid=${params.userid}`)

}

// 获取消息列表
export const getMessageListAPi = (params) => {
	return get(
		`getAlarmList&userid=${params.userid}&imei=${params.imei}`)

}

// 定时喂食记录
export const getClockListApi = (params) => {
	return get(
		`getweishilist&userid=${params.userid}&imei=${params.imei}`)
}
// 添加i定时喂食
export const addWeiShiApi = (params) => {
	return get(
		`addweishi&userid=${params.userid}&imei=${params.imei}&time=${params.time}&week=${params.week}&fenshu=${params.fenshu}&remark=${params.remark}&on=${params.on}&fenzuid=${params.fenzuid}&date=${params.date}
`
	)
}
// 添加i定时喂食
export const changeWeiShiApi = (params) => {
	return get(
		`modyweishi&id=${params.id}&time=${params.time}&week=${params.week}&fenshu=${params.fenshu}&remark=${params.remark}&on=${params.on}&date=${params.date}
`
	)
}
// 注销
export const zhuxiaoAPiu = (params) => {
	return get(`
delUser&userid=${params}
	`)
}
// 删除
export const removeWeiSiApi = (params) => {
	return get(`
	delweishi&id=${params}
	`)
}


//根据id获取设备详情
export const getAdminApi = (params) => {
	return get(
		`getDeviceDetail&id=${params}`
	)
}


//添加设备
export const addShebei = (params) => {
	return get(
		`addDevice&imei=${params.imei}&userid=${params.userid}&title=${params.title}&deviceimg=${params.headerImg}&logx=${params.logx}&logy=${params.logy}&address=${params.address}&cw_lxdh=${params.phone}&cw_lxr=${params.lianxiren}&cw_sr=${params.shengri}&cw_sex=${params.sex}&cw_zl=${params.chongwu}&cw_zl_sub=${params.cate}&cw_tz=${params.tizhong}&cw_remark=${params.remark}&cw_tc=${params.tichang}`
	);
};
//修改设备
export const changeSheBei = (params) => {
	return get(
		`modyDevice&imei=${params.imei}&userid=${params.userid}&title=${params.title}&deviceimg=${params.headerImg}&logx=${params.logx}&logy=${params.logy}&address=${params.address}&cw_lxdh=${params.phone}&cw_lxr=${params.lianxiren}&cw_sr=${params.shengri}&cw_sex=${params.sex}&cw_zl=${params.chongwu}&cw_zl_sub=${params.cate}&cw_tz=${params.tizhong}&cw_remark=${params.remark}&cw_tc=${params.tichang}`
	);
};

//修改设备名称
export const changeSheBeiTitleApi = (params) => {
	return get(`
	modydevicetitle&title=${params.title}&id=${params.id}
	`)
}

// 删除设备
export const removeDeviceApi = (params) => {
	return get(`
	delDevice&id=${params}
	`)
	//delchongwu&id=${params}
}

// 删除宠物
export const removeChongWuApi = (params) => {
	return get(`
	delchongwu&id=${params}
	`)
	//delchongwu&id=${params}
}

//常见问题
export const getWenTiLustApu = (params) => {
	return get(`
	helpqus
	`)
}



//获取电子围栏列表
export const getDianZiWeiLanAPi = (params) => {
	return get(`
	getDzwlList&userid=${params.userid}&imei=${params.imei}
	`)
}

//添加圆形围栏
export const yuanWeiLan = (params) => {
	return get(`
	addyxDzwl&userid=${params.userid}&imei=${params.imei}&title=${params.title}&points=${params.points}&type= ${params.type} &radius=${params.radius}
	`)
}
//添加多边形围栏
export const duobianxingweilan = (params) => {
	return get(`
	addDzwl&userid=${params.userid}&imei=${params.imei}&title=${params.title}&points=${params.points}&type= ${params.type} &radius=${params.radius}
	`)
}
// 查看围栏详情
export const weilanDetails = (params) => {
	return get(`
	getDzwlDetail&wlid=${params}
	`)
}
// 修改电子围栏
export const changeWeiLan = (params) => {
	return get(
		`modyDzwl&userid=${params.userid}&imei=${params.imei}&title=${params.title}&points=${params.points}&type=${params.type}&radius=${params.radius||''}&id=${params.id}&zdlevel=${params.zdlevel}&djlevel=${params.djlevel}
`
	);
}
// 禁用电子围栏
export const changeStatusApi = (params) => {
	return get(
		`modyDzwlStatus&ids=${params.id}&dzwlstatus=${params.status}
`
	);
}

//获取喂食记录
export const getWeiShiListAPi = (params) => {
	return get(`
	getsdweishilist&userid=${params.userid}&imei=${params.imei}
	`)
}

//获取喂食记录列表
export const getwsjiluListAPi = (params) => {
	return get(`
	getwsjiluList&userid=${params.userid}&imei=${params.imei}
	`)
}

//删除喂食
export const removeWeiShiApi = (params) => {
	return get(`
	delsdweishi&id=${params}
	`)
}

//删除-喂食记录列表
export const delwsjiluApi = (params) => {
	return get(`
	delwsjilu&id=${params}
	`)
}

//获取报警列表
export const baoJingListApi = (params) => {
	return get(`
	getAlarmList&userid=${params.userid}&imei=${params.imei}
	`)
}

//删除设备信息
export const removeMessageAPiS = (params) => {
	return get(`delalarm&id=${params}`)
}
//删除报警列表
export const removeBaoJingList = (params) => {
	return get(`
	delalarm&userid=${params.userid}&imei=${params.imei}}&id=${params.id}
	`)
}

//意见反馈
export const yijianAPi = (params) => {
	return get(`
	addFeedback&userid=${params.userid}&email=${params.email}&datetime=${params.time}&imei=${params.admin}&content=${params.details}&type=1&pics=${params.uploadImgs}
	`)
}

//配网结果
export const wifiResultApi = (params) => {
	return get(`
	isconfignetok&mac=${params.mac}&userid=${params.userid}
	`)
}
//配网结果
export const addShebeis = (params) => {
	return get(`
	addDevice&${params}
	`)
}